package com.qijian.maindata.domain.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Data
public class GanttBOMDetailNewVo {

    @JsonSerialize(using = ToStringSerializer.class)
    private Long projectId;

    @JsonSerialize(using = ToStringSerializer.class)
    private String id;
    @JsonSerialize(using = ToStringSerializer.class)
    private String detailId;

    @JsonSerialize(using = ToStringSerializer.class)
    private String pid;

    @JsonSerialize(using = ToStringSerializer.class)
    private String parent;

    @JsonProperty("text") // 将 label 映射为 text
    private String label;

    // 1.bom节点  2.车间 3.project  4.bom
    @JsonProperty("date_type") // 将 label 映射为 text
    private String type;


    private String lineCode;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonProperty("start_date")
    private LocalDateTime startTime;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonProperty("end_date") // 字段名映射为 start_date
    private LocalDateTime endTime;

    //左侧 label
    private String label1;
    private String label2;
    private String label3;
    private String label4;
    private String label5;
    private String label6;



    public String getDate(LocalDateTime time) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return time.format(formatter);
    }
}
